﻿<?php
class Model_Shipper extends Zend_Db_Table_Abstract
{
	protected $_name = 'shipper';

	public function createShipper ($ship_id,$ship_ten)
	{
		$rowShipper= $this->createRow();
		if ($rowShipper) {
			// update the row values
			$rowShipper->ship_id = $ship_id;
			$rowShipper->ship_ten = $ship_ten;		
			$rowShipper->save();			
			//return the new Order			
			return $rowShipper;
		} else {
			throw new Zend_Exception("Không tạo được phương thức vận chuyển !");
		}
	}
		
	public static function getShipperById($ship_id)
	{
		$shipperModel = new self();
		$select = $shipperModel->select();
		$select->order(array('ship_id'))
			   ->where('ship_id =?',$ship_id);	
		return $shipperModel->fetchAll($select);
	}
	
    public function fetchLatest($count =6 )
    {
        return $this->fetchAll(null, 
            'ship_id DESC', $count);
    }
	
	
}